@echo off

set NAME=thc_rpg
set VERSION=0_8_7_alpha

REM Source paths
set BUILDDIR=build
set PLUGINFILE=thc_rpg.smx
set PLUGINFILES=cstrike\*
set SOURCEDIR=src\*

REM Destination paths
set RELEASEDIR=release
set SOURCE_DEST=%RELEASEDIR%\addons\sourcemod\scripting
set PLUGINDIR=%RELEASEDIR%\addons\sourcemod\plugins
set ZIPFILE=%NAME%_v%VERSION%.zip

REM Clean build and release directory.
rmdir /S /Q %RELEASEDIR%
echo "Cleaned build and release directory."

REM Make release directory.
mkdir %RELEASEDIR%

REM Compile plugin.
call compile.bat

REM Copy all files.
echo "Copying plugin files..."
xcopy /S /Y /Q %PLUGINFILES% %RELEASEDIR%
    
REM Copy files.
echo "Copying plugin binary..."
mkdir %PLUGINDIR%
xcopy /S /Y /Q %BUILDDIR%\%PLUGINFILE% %PLUGINDIR%

echo "Copying plugin source code..."
mkdir %SOURCE_DEST%
xcopy /S /Y /Q %SOURCEDIR% %SOURCE_DEST%

REM Make release package.
echo "Compressing files..."
cd %RELEASEDIR%
..\env\win32\bin\7z.exe a -y %ZIPFILE% *

echo "Release package available at %RELEASEDIR%\%ZIPFILE%"

pause
